<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>版本控制</title>
    <!--layui-->
    <link rel="stylesheet" href="js/layui/css/layui.css">
    <!--bootstrap-select  css文件-->
    <link rel="stylesheet" type="text/css" href="js/bootstrapselect/css/bootstrap.min.css"/>
    <link rel="stylesheet" type="text/css" href="js/bootstrapselect/css/bootstrap-select.css"/>
    <!--弹窗 css文件-->
    <link rel="stylesheet" type="text/css" href="js/layer/layer.css">
    <!--文件树插件 css文件-->
    <link rel="stylesheet" type="text/css" href="js/jstree/css/style.min.css">
    <!--主要css样式-->
    <link rel="stylesheet" type="text/css" href="css/models.css">
    <style type="text/css">
        .layui-upload-button {
            position: absolute;
            display: inline-block;
            vertical-align: middle;
            min-width: 60px;
            width: 60%;
            height: 42px;
            line-height: 42px;
            top: 0;
            left: 130px;
            opacity: 0;
            overflow: hidden;
            background-color: #fff;
            color: #666;
            cursor: pointer;
        }

        #ph_updateDetailBox {
            padding: 5%;
        }
    </style>
</head>
<body>
<div class="MainContent">
    <!--主体内容-->
    <div class="MainCont">
        <div class="ph_snbBtn">
            <button class="columnBtn js_addLabour" name="" value="发布版本">发布版本</button>
        </div>
        <!--筛选条件-->
        <div class="ph_screen">
            <table class="ph_tableBox">
                <tr>
                    <th>版本号：</th>
                    <td><input name="" type="text"></td>
                    <td colspan="4">
                        <input name="" type="button" value="搜索"><input name="" type="button" value="重置">
                    </td>
                </tr>
            </table>
        </div>
        <!--end 筛选条件-->
        <!--列表-->
        <div class="ph_wareBox ph_tabScroll">
            <table class="ph_wareList" id="example"></table>
        </div>
        <!--end 列表-->
    </div>
    <!--end 主体内容-->
</div>
<!--更新版本弹窗-->
<div class="PopupBox" id="ph_updateBox">
    <!--内容-->
    <div class="ph_subPoCon">
        <form id="formID">
            <ul class="addList">
                <li>
                    <label for=""><span class="require">*</span>版本号：</label>
                    <input class="memberTxt validate[required]" name="" type="text" placeholder="请输入版本号">
                </li>
                <li>
                    <label for=""><span class="require">*</span>版本名：</label>
                    <input class="memberTxt validate[required]" name="" type="text" placeholder="请输入版本号">
                </li>
                <li>
                    <label for=""><span class="require">*</span>客户端：</label>
                    <span class="radioBtn"><input name="radio" type="radio">Android</span>
                    <span class="radioBtn"><input name="radio" type="radio">IOS</span>
                </li>
                <li>
                    <label for=""><span class="require">*</span>版本文件：</label>
                    <input class="memberTxt fileTxt ph_disabled" id="fileTxt" name="" type="text" disabled="disabled"
                           placeholder="请选择文件">
                    <input class="fileImport" id="fileApk" name="" type="file" accept=".apk">
                </li>
                <li>
                    <label for=""><span class="require">*</span>更新内容：</label>
                    <textarea name="" id="" cols="30" rows="10" style="width:60%;"></textarea>
                </li>
                <li><label for="">是否发布：</label><input class="isActive" id="" name="" type="checkbox"></li>
                <li><label for="">是否强制更新：</label><input class="isActive" id="" name="" type="checkbox"></li>
            </ul>
        </form>
    </div>
    <!--end 内容-->
</div>
<!--end 更新版本弹窗-->
<!--更新内容弹窗-->
<div class="PopupBox" id="ph_updateDetailBox">
    <!--内容-->
    <div class="ph_subPoCon">
        <div id="update_Detail">
            这里显示更新内容
        </div>
    </div>
    <!--end 内容-->
</div>
<!--end 更新内容弹窗-->
<script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<!--bootstrap-select-->
<script type="text/javascript" src="js/bootstrapselect/bootstrap.min.js"></script>
<script type="text/javascript" src="js/bootstrapselect/bootstrap-select.js"></script>
<script type="text/javascript" src="js/bootstrapselect/select.js"></script>
<!--验证-->
<script type="text/javascript" src="js/validat/jquery.validationEngine-zh_CN.js"></script>
<script type="text/javascript" src="js/validat/jquery.validationEngine.js"></script>
<!--分页-->
<script type="text/javascript" src="js/pages/jquery.dataTables.min.js"></script>
<!--图片上传-->
<script type="text/javascript" src="js/imgUp.js"></script>
<!--弹窗-->
<script type="text/javascript" src="js/layer/layer.js"></script>
<!--layui-->
<script type="text/javascript" src="js/layui/layui.js"></script>
<script type="text/javascript">
    var layer;
    var upload;
    $(function () {
        //layui upload
        layui.use(['layer', 'upload'], function () {
            layer = layui.layer;
            upload = layui.upload;
            var url = '/web/memberCard/';
            var index;
            upload({
                url: url,
                elem: '#fileApk',
                ext: 'apk',
                title: '上传版本文件apk',
                type: 'file',
                before: function () {
                    $('#fileTxt').val($('#fileApk').val());
                    index = layer.msg('导入中...', {time: 0});
                },
                success: function (data) { //上传成功后的回调
                    if (data.code == 200) {
                        layer.close(index);
                        layer.alert("成功上传apk文件");
                    } else {
                        layer.msg(data.message);
                    }
                },
                error: function (data) {
                    layer.close(index);
                    layer.msg(data.message);
                }
            });
        });
        //选择文件
        $('.addList').on('change', '.fileImport', function () {
            var fileUrl = $(this).val();
            if (fileUrl != '') {
                var reg = /^.*\.(?:apk)$/i;    //文件名可以带空格
                if (!reg.test(fileUrl)) {   //校验不通过
                    alert("请上传apk格式的文件!");
                    return;
                }
            }
            $('.fileTxt').val(fileUrl);
        });

        $("#formID").validationEngine({
            addPromptClass: 'formError-text',
            showArrow: false,
            promptPosition: 'bottomLeft:10 0'
        });
        //更新版本
        $('.ph_snbBtn').on('click', '.js_addLabour', function () {
            layer.open({
                type: 1,
                title: '更新版本',
                closeBtn: 1,
                area: ['460px', '565px'],
                //maxmin: true,
                btn: ['保存', '取消'],
                btnAlign: 'c',
                content: $('#ph_updateBox')
            });
        });

        //发布
        $('.ph_wareList').on('click', '.js_Frozen', function () {
            layer.confirm('确定此操作吗？', {
                title: '发布',
                icon: 3,
                btnAlign: 'c',
                closeBtn: 0
            }, function (index) {
              //layer.alert('操作成功', {icon: 1, btnAlign: 'c', closeBtn: 0});
                layer.alert('操作失败', {icon: 2, btnAlign: 'c', closeBtn: 0});
                //layer.close(index);
            });
        });
        //编辑
        $('.ph_wareList').on('click', '.js_addLabour', function () {
            layer.open({
                type: 1,
                title: '编辑',
                closeBtn: 1,
                area: ['460px', '450px'],
                //maxmin: true,
                btn: ['保存', '取消'],
                btnAlign: 'c',
                content: $('#ph_updateBox')
            });
        });
        //删除
        $('.ph_wareList').on('click', '.Js_delete', function () {
            layer.confirm('确定此操作吗？', {
                title: '删除',
                icon: 3,
                btnAlign: 'c',
                closeBtn: 0
            }, function (index) {
                layer.alert('操作成功', {icon: 1, btnAlign: 'c', closeBtn: 0});
                //layer.alert('操作失败', {icon: 2, btnAlign: 'c', closeBtn: 0});
                //layer.close(index);
            });
        });
        $('#example').DataTable({
            "bServerSide": true,
            "sPaginationType": "full_numbers",
            //"bJQueryUI": true,
            "sDom": '<"">t<"F"ip>',
            "autoWidth": false,  //自适应宽度
            //"sAjaxSource": "${ctx}/api/user/list", //ajax调用接口
            //<div class="btn-group" style="text-align:left;"><button type="button" class="btn btn-info dropdown-toggle"data-toggle="dropdown">操作 <span class="caret"></span></button>
            "sAjaxSource": "data/arrays.txt", //ajax调用接口
            "aoColumnDefs": [{sDefaultContent: '', orderable: false, aTargets: ['_all']}],
            "aoColumns": [
                /*{ "sWidth": "40px","sTitle" : "<input class= \"check-all\" name=\"\" type=\"checkbox\">", "mData": "id","mRender": function(){
                    return '<input class="ids" name="" type="checkbox">';
                }},*/
                {"sWidth": "50px", "sTitle": "版本号", "mData": "id"},
                {"sTitle": "版本名", "mData": "id2"},
                {"sTitle": "客户端", "mData": "id2"},
                {"sTitle": "文件名", "mData": "id3"},
                {"sTitle": "发布时间", "mData": "id4"},
                {
                   "sTitle": "更新内容", "mData": "id8", "mRender": function () {
                    return '<a href="javascript:void(0);" class="lookColor update_detail">查看</a>';//gray 灰色
                    //return '<span>正常</span>';  默认颜色就不用加样式名
                }
                },
                {"sTitle": "发布人", "mData": "id4"},
                {
                    "sWidth": "100px", "sTitle": "状态", "mData": "id8", "mRender": function () {
                    // return '<span class="gray">已禁用</span>';//gray 灰色
                    return '<span>已启用</span>';  //默认颜色就不用加样式名
                }
                },
                {"sTitle": "强制更新", "mData": "id4"},
                {
                    "sWidth": "110px",
                    "sTitle": "操作",
                    "mData": "id",
                    "sClass": "ph_tableShow",
                    "mRender": function (data, type, full) {
                        var text = '<div class="operateBox"><input class="operate" name="" type="button" value="操作选项">';
                        text += '<ul class="operateList hide" role="menu">';
                        text += '<li><a class="js_Frozen" href="javascript:void(0);">发布</a></li>';
                        text += '<li><a class="js_addLabour" href="javascript:void(0);">编辑</a></li>';
                        text += '<li><a class="Js_delete" href="javascript:void(0);">删除</a></li>';
                        text += '</ul></div>';
                        return text;
                    }
                }
            ],
            "oLanguage": {
                "sProcessing": "数据加载中······",
                "sLengthMenu": "显示 _MENU_ 条记录",
                "sZeroRecords": "没有您要搜索的内容！",
                "sEmptyTable": "列表中无数据存在！",
                "sInfo": "当前显示 _START_ 到 _END_ 条数据，共 _TOTAL_ 条数据",
                "sInfoEmpty": "显示 0 到 0 条记录",
                "sInfoFiltered": "数据列表中共  _MAX_ 条记录",
                "oPaginate": {
                    "sFirst": "首页",
                    "sPrevious": "上一页",
                    "sNext": "下一页",
                    "sLast": "末页"
                }
            },
            "fnDrawCallback": function () {
                //表格查看更新内容
                $('.update_detail').click(function () {
                    layer.open({
                        type: 1,
                        title: '更新内容',
                        closeBtn: 1,
                        area: ['460px', '265px'],
                        //maxmin: true,
                        btnAlign: 'c',
                        content: $('#ph_updateDetailBox')
                    });
                })
            }

            /*"fnServerData" : function ( sSource, aoData, fnCallback, oSettings ) {
               oSettings.jqXHR = $.ajax( {
                   "dataType" 	: 'json',
                   "type" 		: "GET",
                   "async"     : 'false',
                   "url" 		: sSource,
                   "data" 		: {
                       'pageNum': (aoData[3].value/aoData[4].value)+1,
                       'pageSize' :  aoData[4].value,
                       'telphone'  :  $("#telphone").val(),
                       'isable' : $('#isable').val()
                   },
                   "success"	: fnCallback
               } );
           }*/
        });
    });
</script>
</body>
</html>